import { createRouter, createWebHashHistory } from "vue-router"

const routes = [
    { 
        path: '/', 
        meta: { title: '首页' },
        component: () => import('@/views/Home.vue'),
        redirect: '/dashboard',
        children: [
            { path: 'dashboard', name: 'dashboard', meta: { title: 'dashboard' }, component: () => import('@/views/Dashboard.vue') },
            { path: 'vmodel', name: 'vmodel', meta: { title: 'v-model使用' }, component: () => import('@/views/basic/V-ModelDemo.vue') },
            { path: 'computedwatch', name: 'computedwatch', meta: { title: '计算属性和watch' }, component: () => import('@/views/basic/ComputedWatch.vue') },
            { path: 'provideinject', name: 'provideinject', meta: { title: 'provide和inject' }, component: () => import('@/views/basic/ProvideInject.vue') },
        ]
    },
    { path: '/login', name: 'login', meta: { title: '登录' }, component: () => import('@/views/Login.vue') },
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router